package com.quan.OGCamera;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import com.example.test1.R;

import android.app.Activity;
import android.os.Bundle;
import android.widget.ListView;
import android.widget.SimpleAdapter;

public class PickOverlayActivity extends Activity {

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.gallery);
        
        int[] overlayitems = new int[]{
                R.drawable.glass1,         
          //here you have to give image name which you already pasted it in /res/drawable-hdpi/
                R.drawable.glass2,   
                R.drawable.glass3,
            };

        List<HashMap<String,String>> aList = new ArrayList<HashMap<String,String>>();

        for(int i=0;i<3;i++){
            HashMap<String, String> hm = new HashMap<String,String>();
            hm.put("overlayitem", Integer.toString(overlayitems[i]) );
            aList.add(hm);
        }
        
        // Instantiating an adapter to store each items
        // R.layout.listview_layout defines the layout of each item
        String[] from = {"overlayitem"};
        int[] to = {R.id.overlayitem};
        SimpleAdapter adapter = new SimpleAdapter(this,aList,R.layout.listview_layout,from,to);
      
        // Getting a reference to listview of main.xml layout file
        ListView listView = ( ListView ) findViewById(R.id.listview);

        // Setting the adapter to the listView
        listView.setAdapter(adapter);
        
        //Add listener
        listView.setOnItemClickListener(new NewOnListViewItemClickListener());
        
    }
}